﻿using System;
using System.Collections.Generic;
using System.Device.Location;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Controls.Maps;
using MyMeetup.ViewModels;

namespace MyMeetup
{
    public partial class MapPage : PhoneApplicationPage
    {

        private MapViewModel _mapViewModel;

        public MapPage()
        {
            InitializeComponent();
        }


        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            string lon;
            string lat;
            string title = "";

            NavigationContext.QueryString.TryGetValue("lon", out lon);
            NavigationContext.QueryString.TryGetValue("lat", out lat);
            NavigationContext.QueryString.TryGetValue("title", out title);

            _mapViewModel = new MapViewModel(double.Parse(lat), double.Parse(lon));
            _mapViewModel.Title = title;
            DataContext = _mapViewModel;
        }
    
    }
}